//
//  CFriendListView.h
//  HCHK_iphone
//
//  Created by yilong zhang on 12-1-2.
//  Copyright 2012年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UIViewEx.h"
#import "CFriend.h"
#import "CShareView.h"
#import "CMainPageCtrl.h"

@class CUser;
@class CMainPageCtrl;
@class CRootCtrlManager;

@protocol SearchViewDelegate;

//========================================================================================================================

@interface CFrdItemView : UIViewEx

@property (nonatomic, assign) UIImageView       *m_Icon;
@property (nonatomic, assign) UILabel           *m_Nick;
@property (nonatomic, assign) UILabel           *m_City;
@property (nonatomic, assign) UILabel           *m_FrdNum;
@property (nonatomic, assign) UILabel           *m_PdtNum;
@property (nonatomic, assign) UILabel           *m_DisNum;

@end

//========================================================================================================================

@interface UITableViewCellEx : UITableViewCell

@property (nonatomic, assign) CFrdItemView      *m_InfoView;

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier Size:(CGSize)size;

@end

//========================================================================================================================

@protocol FriendListViewDelegate <NSObject>

@optional
-(void)DidFriendListSelected:(CFriend*)friend;

@end

//========================================================================================================================

@interface CFriendListView : UIViewEx <UITableViewDataSource, UITableViewDelegate, UIScrollViewDelegate,OperationDelegate, UISearchBarDelegate>

@property (nonatomic, assign) id<FriendListViewDelegate>    delegate;

@property (nonatomic, assign) UISearchBar               *m_SearchView;
@property (nonatomic, assign) UIScrollView              *m_Scroll;
@property (nonatomic, assign) UITableView               *m_TableView;
@property (nonatomic, assign) UITableViewCellEx         *m_Cell;
@property (nonatomic, retain) NSMutableArray            *m_Frds;
@property (nonatomic, assign) long                      m_UserID;
@property (nonatomic, assign) BOOL                      m_bIsLoading;
@property (nonatomic, assign) BOOL                      m_bIsPageEnd;
@property (nonatomic, assign) CAscCounter               *m_NativeCnt;
@property (nonatomic, assign) CAscCounter               *m_NetCnt;
@property (nonatomic, retain) CTask                     *m_Task;
@property (nonatomic, assign) UIView                    *m_FootView;
@property (nonatomic, assign) UIView                    *m_LoadView;
@property (nonatomic, assign) UILabel                   *m_NoData;

//loadview
-(void)SetUpLoadView;
-(void)ShowLoadView;
-(void)HiddenLoadView;

//footview
-(void)ShowFootView;
-(void)HiddenFootView;

-(void)AddSearchView;
-(void)CommitSearchRequest;
-(void)ReceiveSearchResponse:(NSDictionary*)data;

-(int)GetUsersFriends;
-(void)SetFrdLstViewInfo;
-(void)AddNetFriendsToList:(NSArray*)friends;
-(void)AddFriendsToList:(NSArray*)friends;
-(void)ClearData;

-(NSArray*)GetNativeFriend:(int)offset Limit:(int)limit Table:(NSString*)table;
-(void)CommitMyFriendsRequest:(int)offset Limit:(int)limit Action:(NSString*)action;

@end
